import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

import static java.lang.Thread.sleep;

public class SearchTest {
    public static WebDriver driver;
    private static String URL = "http://localhost:8077/Ascent/";
    public static usebrowser useBrowser = new usebrowser();
    public static void main(String[] args) {
        try {
            driver = useBrowser.StartChrome(URL);
            driver.findElement(By.name("username")).sendKeys("lixing");
            sleep(2000);
            driver.findElement(By.name("password")).sendKeys("password");
            sleep(2000);
            driver.findElement(By.xpath("/html/body/form/div[2]/div[3]/table/tbody/tr[2]/td[1]/input")).click();
            sleep(2000);
            driver.findElement(By.xpath("/html/body/div[2]/div[5]/div/a[2]")).click();
            sleep(2000);
            driver.findElement(By.name("searchValue")).sendKeys("西药");
            sleep(2000);
            driver.findElement(By.name("Submit")).click();
            sleep(2000);
            driver.close();
        } catch (Exception e) {
            System.out.println(e);
        }
    }
}